import request from '@/config/axios'

// 点赞 VO
export interface LikesVO {
  id: number // 主键
  userId: number // 用户ID
  targetId: number // 目标资源ID
  targetType: string // 目标资源类型
  likeTime: Date // 点赞时间
  creatorName: string // 创建人
  updaterName: string // 更新人
  version: number // 版本号
}

// 点赞 API
export const LikesApi = {
  // 查询点赞分页
  getLikesPage: async (params: any) => {
    return await request.get({ url: `/common/likes/page`, params })
  },

  // 查询点赞详情
  getLikes: async (id: number) => {
    return await request.get({ url: `/common/likes/get?id=` + id })
  },

  // 新增点赞
  createLikes: async (data: LikesVO) => {
    return await request.post({ url: `/common/likes/create`, data })
  },

  // 修改点赞
  updateLikes: async (data: LikesVO) => {
    return await request.put({ url: `/common/likes/update`, data })
  },

  // 删除点赞
  deleteLikes: async (id: number) => {
    return await request.delete({ url: `/common/likes/delete?id=` + id })
  },

  // 导出点赞 Excel
  exportLikes: async (params) => {
    return await request.download({ url: `/common/likes/export-excel`, params })
  },
}